/**
 * IsvRequestParamAssembleType.java
 * author: yujiakui
 * 2017年8月29日
 * 下午4:34:58
 */
package com.ctim.service.enums;

import java.text.MessageFormat;

import org.apache.commons.lang3.StringUtils;

import com.ctim.common.exception.PcsRunTimeException;
import com.ctim.model.IEnum;

/**
 * @author yujiakui
 *
 *         下午4:34:58
 *
 *         渠道请求参数组装类型
 */
public enum IsvRequestParamAssembleTypeEnum implements IEnum {

	/** XML类型解析器 */
	XML("XML", "XML类型解析器", "xml", "XML类型解析器");

	private String code;

	private String chineseName;

	private String englishName;

	private String desc;

	/**
	 * 根据code查询对应的枚举类型
	 *
	 * @param code
	 * @return
	 */
	public static IsvRequestParamAssembleTypeEnum getByCode(String code) {
		for (IsvRequestParamAssembleTypeEnum ele : values()) {
			if (StringUtils.equals(ele.getCode(), code)) {
				return ele;
			}
		}

		throw new PcsRunTimeException(
				MessageFormat.format("根据code={0}查询对应的枚举IsvRequestParamAssembleTypeEnum不存在", code));
	}

	private IsvRequestParamAssembleTypeEnum(String code, String chineseName, String englishName, String desc) {
		this.code = code;
		this.chineseName = chineseName;
		this.englishName = englishName;
		this.desc = desc;
	}

	/**
	 * @return the code
	 */
	@Override
	public String getCode() {
		return code;
	}

	/**
	 * @param code
	 *            the code to set
	 */
	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * @return the chineseName
	 */
	@Override
	public String getChineseName() {
		return chineseName;
	}

	/**
	 * @param chineseName
	 *            the chineseName to set
	 */
	public void setChineseName(String chineseName) {
		this.chineseName = chineseName;
	}

	/**
	 * @return the englishName
	 */
	@Override
	public String getEnglishName() {
		return englishName;
	}

	/**
	 * @param englishName
	 *            the englishName to set
	 */
	public void setEnglishName(String englishName) {
		this.englishName = englishName;
	}

	/**
	 * @return the desc
	 */
	@Override
	public String getDesc() {
		return desc;
	}

	/**
	 * @param desc
	 *            the desc to set
	 */
	public void setDesc(String desc) {
		this.desc = desc;
	}

}
